home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 25
/
Cream of the Crop 25.iso
/
bbs
/
mhis020.zip
/
CALLUTIL.MH
< prev
next >
Wrap
Text File
|
1996-09-17
|
2KB
|
97 lines
#ifndef __CALLUTIL_MH
#define __CALLUTIL_MH
#ifndef __DATE_MH
#include "date.mh"
#endif
long first_caller_index () {
int: temp;
if (callers.forward_search) {
return 0;
}
else {
temp := call_numrecs ();
if (temp = 0) {
if (call_open ()) {
temp := call_numrecs ();
call_close ();
}
else {
print (COL_LRED, "Error openning callers log\n");
};
};
return (temp - 1);
};
}
long caller_index (string: index_string) {
long: idx;
if (index_string = "") {
return first_caller_index ();
};
if (index_string = "=") {
return callers.index;
};
idx := stridx (index_string, 1, '\\');
if (idx) {
struct _date: thedate;
long: calls;
int: call_opened;
struct _callinfo: ci;
call_opened := False;
calls := call_numrecs();
if (calls = 0) {
if (call_open () = False) {
print ("Cannot open callers log!!!\n");
};
calls := call_numrecs ();
call_opened := True;
};
string_to_date (thedate, index_string);
if (callers.forward_search) {
idx := 0;
while (idx < calls AND call_read (idx, ci) AND date_greater (thedate, ci.login.date)) {
idx := idx + 1;
};
}
else {
idx := calls - 1;
while (idx >= 0 AND call_read (idx, ci) AND date_greater (ci.login.date, thedate)) {
idx := idx - 1;
};
};
if (call_opened) {
call_close ();
};
return idx;
};
return strtol (index_string);
}
long caller_index_forward (string: idx_string) {
bool: old_forward_flag;
long: result;
old_forward_flag := callers.forward_search;
callers.forward_search := True;
result := caller_index (idx_string);
callers.forward_search := old_forward_flag;
}
long caller_index_backward (string: idx_string) {
bool: old_forward_flag;
long: result;
old_forward_flag := callers.forward_search;
callers.forward_search := False;
result := caller_index (idx_string);
callers.forward_search := old_forward_flag;
}
#endif